<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>

<h3 style="padding-left: 20px;padding-top: 10px">
	<?=$data['name']?><?php if($data['is_activity']==1){ echo L("activity");}else{ echo L("contest");}?>
	<a href="./index.php?m=contest&c=manage&a=init&is_activity=<?=$data['is_activity']?>" style="font-size:14px;color: #0000FF"><em>返回上一级</em></a>
</h3>
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="?m=contest&c=source&a=init&source_type=1&contest_id=<?=$id?>"   ?><em>资讯</em></a>
		<span>|</span>
		<a href="?m=contest&c=source&a=init&source_type=2&contest_id=<?=$id?>"  > <em>视频</em></a>
		<span>|</span>
		<a href="?m=contest&c=source&a=init&source_type=3&contest_id=<?=$id?>"  ><em>图片</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=album&a=init&contest_id=<?=$id?>"  class="on"  ><em>图片集</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=video&a=init&contest_id=<?=$id?>"   ><em>视频集</em></a>


	</div>
</div>

<div class="pad-lr-10">

	<form name="searchform" action="" method="get">
		<input type="hidden" value="contest" name="m">
		<input type="hidden" value="album" name="c">
		<input type="hidden" value="init" name="a">
		<input type="hidden" value="<?=$id?>" name="contest_id">
		<?php if(isset($_GET['id'])){?>
			<input type="hidden" value="<?=$_GET['id']?>" name="id">
		<?php }?>
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
			<tr>
				<td>
					<button type="button" style="float:right;margin-right:20px;margin-top:10px;" onclick="showAdd()" ><em>添加相册</em></button>
					<span style="clear: both"></span>
					<script>
						function showAdd(){
							window.top.art.dialog({
									id: 'add',
									iframe: '?m=contest&c=album&a=add&id=<?=$id?>',
									title: '添加相册',
									width: '900',
									height: '500',
									lock: true
								},
								function() {
									var d = window.top.art.dialog({
										id: 'add'
									}).data.iframe;
									var form = d.document.getElementById('dosubmit');
									form.click();
									return false;
								},
								function() {
									window.top.art.dialog({
										id: 'add'
									}).close()
								});
						}

					</script>

					<div class="explain-col">

						相册名称：
						<input name="keyword" type="text" value="<?php if(isset($_GET['keyword'])) {echo $_GET['keyword'];}?>"
							   class="input-text" />
						<input type="submit" name="search"  class="button" value="<?php echo L('search')?>" />
					</div>


				</td>
			</tr>
			</tbody>
		</table>
	</form>

	<form name="myform" action="?m=contest&c=album&a=del" method="post"
		  onsubmit="return confirm('<?php echo L('confirm')?>')">
		<div class="table-list">
			<table width="100%" cellspacing="0">
				<thead>
				<tr>
					<th align="left" width="20"><input type="checkbox" value=""
													   id="check_box" onclick="selectall('id[]');"></th>
					<th align="left">ID</th>
					<th align="left"><?php echo "相册名称"?></th>
					<th align="left"><?php echo "相册描述"?></th>
					<th align="left">所属</th>

				
					<th align="left"><?php echo L('contest_operation')?></th>
				</tr>
				</thead>
				<tbody>
				<?php
				foreach ($contestinfo as $k => $v) {
					?>
					<tr>
						<td align="left"><input type="checkbox"
												value="<?php echo $v['id']?>" name="id[]"></td>
						<td align="left"><?php echo $v['id']?></td>
						<td align="left"><?php echo $v['name']?></td>
						<td align="left"><?php echo str_cut($v['description'],20)?></td>
						<td align="left"><?= $v['cname']?></td>
						<td align="left">

							<a
								href="javascript:edit('<?php echo $v['id']?>', '<?php echo  new_addslashes(new_html_special_chars($v['name']))?>')">[<?php echo L('edit')?>]</a> |

							<a href="?m=contest&c=album&a=del&id=<?php echo $v['id']?>"
							   onClick="return confirm('<?php echo L('confirm')?>')">[<?php echo L('contest_del')?>]</a>
							<a href="?m=contest&c=album&a=view&contest_id=<?=$id?>&id=<?php echo $v['id']?>" >[详情]</a>
						</td>
					</tr>
					<?php
				}

				?>
				</tbody>
			</table>

			<div class="btn">
				<label for="check_box">
					<a href="#"
					   onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a
						href="#"
						onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label>
				<input type="submit" class="button" name="dosubmit"
					   value="<?php echo L('delete')?>" />
			</div>

			<div id="pages"><?php echo $pages?></div>
		</div>
	</form>
</div>
<script type="text/javascript">

	function edit(id, name) {
		window.top.art.dialog({id:'edit'}).close();
		window.top.art.dialog({
				title: name,
				id: 'edit',
				iframe: '?m=contest&c=album&a=edit&id=' + id,
				width: '900',
				height: '500'
			},
			function() {
				var d = window.top.art.dialog({
					id: 'edit'
				}).data.iframe;
				d.document.getElementById('dosubmit').click();
				return false;
			},
			function() {
				window.top.art.dialog({
					id: 'edit'
				}).close()
			});
	}

</script>
</body>
</html>